Add userToolLinks on Special:FileDuplicateSearch
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 6 Jul 2012 21:48:08 +0000 (23:48 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Fri, 6 Jul 2012 21:48:08 +0000 (23:48 +0200)
Adding LinkBatch for the file, user and user talk links

Also not linking to user of the foreign wiki, because that can bring
problems, when the user is not the same as the user on this wiki.
ImagePage.php is that already doing when showing the file history.

Change-Id: I72f94db11e7346036e53cddbe431d009de6ba2d3

includes/specials/SpecialFileDuplicateSearch.php

index 18d19db..f8e40e0 100644 (file)
@@ -157,10 +157,24 @@ class FileDuplicateSearchPage extends QueryPage {
                                );
                        }
 
+                       $this->doBatchLookups( $dupes );
                        $this->showList( $dupes );
                }
        }
 
+       function doBatchLookups( $list ) {
+               $batch = new LinkBatch();
+               foreach( $list as $file ) {
+                       $batch->addObj( $file->getTitle() );
+                       if( $file->isLocal() ) {
+                               $userName = $file->getUser( 'text' );
+                               $batch->add( NS_USER, $userName );
+                               $batch->add( NS_USER_TALK, $userName );
+                       }
+               }
+               $batch->execute();
+       }
+
        /**
         *
         * @param Skin $skin
@@ -178,7 +192,17 @@ class FileDuplicateSearchPage extends QueryPage {
                );
 
                $userText = $result->getUser( 'text' );
-               $user = Linker::link( Title::makeTitle( NS_USER, $userText ), $userText );
+               if ( $result->isLocal() ) {
+                       $userId = $result->getUser( 'id' );
+                       $user = Linker::userLink( $userId, $userText );
+                       $user .= $this->getContext()->msg( 'word-separator' )->plain();
+                       $user .= '<span style="white-space: nowrap;">';
+                       $user .= Linker::userToolLinks( $userId, $userText );
+                       $user .= '</span>';
+               } else {
+                       $user = htmlspecialchars( $userText );
+               }
+
                $time = $this->getLanguage()->userTimeAndDate( $result->getTimestamp(), $this->getUser() );
 
                return "$plink . . $user . . $time";